package com.tencent.web.controller;

import com.github.pagehelper.PageInfo;
import com.tencent.entity.CheckGroup;
import com.tencent.entity.Pagination;
import com.tencent.entity.Result;
import com.tencent.service.CheckGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: Fame
 * @date: 2022-08-11 15:57
 * @description:
 */
@RestController
@RequestMapping("/check")
public class CheckGroupController {

    @Autowired
    private CheckGroupService checkGroupService;

    @RequestMapping("/findAll")
    public Result findAll(Pagination pagination){
        PageInfo<CheckGroup> all = checkGroupService.getAll(pagination);
//        Result result = new Result(true, "ok", all);
        return Result.success(all);
    }

    @RequestMapping("/addOne")
    public int addBean( CheckGroup checkGroup){
        return checkGroupService.insert(checkGroup);
    }

    @PostMapping("/delOne")
    public int delBean(String id){
        return checkGroupService.delHandle(id);
    }

    @GetMapping("/findById")
    public CheckGroup getBeanById(Integer id){
        return checkGroupService.findById(id);
    }

    @PostMapping("/updateById")
    public int updateBean(CheckGroup checkGroup){
        return  checkGroupService.updateBean(checkGroup);
    }
}
